/**
 * Created by Administrator on 2018/11/29/0029.
 */
//初始化layer弹框
layui.use('layer', function(){
    layer = layui.layer;
});
//表单提交
$("#insert").click(function(){
    //密码规则
    var user_name = $("#user_name").val();
    var user_pwd  = $("#user_pwd").val();
    var code      = $("#auth_code").val();
    if(!user_name){
        layer.msg('请输入管理员账号',{icon:5,time:2000});
        return;
    }
    if(!user_pwd){
        layer.msg('请输入管理员密码',{icon:5,time:2000});
        return;
    }
    if(!code){
        layer.msg('请输入验证码',{icon:5,time:2000});
        return;
    }
    $.ajax({
        url:"/login/checkLogin",
        data:$("#adminLogin").serialize(),
        type:"post",
        dataType:"json",
        success:function(res){
            if(res.code){
                layer.msg(res.msg,{icon:1,time:2000},function(){
                    window.location.href = "/sport_admin/index"
                });
            }else{
                layer.msg(res.msg,{icon:5,time:2000});
                $("#imgs")[0].click();
            }
        }
    })
});